﻿// -----------------------------------------------------------------------
// <copyright file="AmazonSigningBehaviorExtensionElement.cs" company="EPAM Systems">
////Copyright (c) EPAM Systems, 2012. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace MBOP.DistributedServices.AmazonHeaders
{
	#region Usings

	using System;
	using System.Configuration;
	using System.ServiceModel.Configuration;

	#endregion

	/// <summary>
	/// Provides Amazon signing behavior extension.
	/// </summary>
	public class AmazonSigningBehaviorExtensionElement : BehaviorExtensionElement
	{
		#region Properties
		/// <summary>
		/// Gets or sets the access key id.
		/// </summary>
		[ConfigurationProperty("accessKeyId", IsRequired = true)]
		public string AccessKeyId
		{
			get { return (string)base["accessKeyId"]; }
			set { base["accessKeyId"] = value; }
		}

		/// <summary>
		/// Gets or sets the secret key.
		/// </summary>
		[ConfigurationProperty("secretKey", IsRequired = true)]
		public string SecretKey
		{
			get { return (string)base["secretKey"]; }
			set { base["secretKey"] = value; }
		}

		/// <summary>
		/// Gets the behavior type.
		/// </summary>
		public override Type BehaviorType
		{
			get
			{
				return typeof(AmazonSigningEndpointBehavior);
			}
		}

		#endregion

		#region Protected Methods

		/// <summary>
		/// Creates new behavior.
		/// </summary>
		/// <returns>The new behavior.</returns>
		protected override object CreateBehavior()
		{
			return new AmazonSigningEndpointBehavior(this.AccessKeyId, this.SecretKey);
		}

		#endregion
	}
}
